create  table jms_dm.dm_end_dispatch_inout_hour_dt
(       virt_code varchar(50) comment '虚拟代理区code',
        agent_code varchar(50) comment '代理区编码',
        scan_site_code varchar(50) comment '网点编码',
        store_code varchar(50) comment '门店编码',
        date_time date comment '查询日期',
        virt_name varchar(120) comment '虚拟代理区name',
        agent_name varchar(120) comment '代理区名称',
        fran_code varchar(50) comment '加盟商code',
        fran_name varchar(120) comment '加盟商名称',
        scan_site_name varchar(120) comment '网点名称',
        business_id varchar(50) comment '品牌id',
        business_name varchar(120) comment '品牌名称',
        source varchar(120) comment '末端类型',
        build_type varchar(120) comment '建设类型',
        store_type varchar(120) comment '门店属性',
        store_name varchar(120) comment '门店名称',
        scan_cnt_in      int comment '入库总量',
        scan_cnt_out     int comment '出库总量',
        in_time_stage00  int comment '入库量00-01',
        out_time_stage00 int comment '出库量00-01',
        in_time_stage01  int comment '入库量01-02',
        out_time_stage01 int comment '出库量01-02',
        in_time_stage02  int comment '入库量02-03',
        out_time_stage02 int comment '出库量02-03',
        in_time_stage03  int comment '入库量03-04',
        out_time_stage03 int comment '出库量03-04',
        in_time_stage04  int comment '入库量04-05',
        out_time_stage04 int comment '出库量04-05',
        in_time_stage05  int comment '入库量05-06',
        out_time_stage05 int comment '出库量05-06',
        in_time_stage06  int comment '入库量06-07',
        out_time_stage06 int comment '出库量06-07',
        in_time_stage07  int comment '入库量07-08',
        out_time_stage07 int comment '出库量07-08',
        in_time_stage08  int comment '入库量08-09',
        out_time_stage08 int comment '出库量08-09',
        in_time_stage09  int comment '入库量09-10',
        out_time_stage09 int comment '出库量09-10',
        in_time_stage10  int comment '入库量10-11',
        out_time_stage10 int comment '出库量10-11',
        in_time_stage11  int comment '入库量11-12',
        out_time_stage11 int comment '出库量11-12',
        in_time_stage12  int comment '入库量12-13',
        out_time_stage12 int comment '出库量12-13',
        in_time_stage13  int comment '入库量13-14',
        out_time_stage13 int comment '出库量13-14',
        in_time_stage14  int comment '入库量14-15',
        out_time_stage14 int comment '出库量14-15',
        in_time_stage15  int comment '入库量15-16',
        out_time_stage15 int comment '出库量15-16',
        in_time_stage16  int comment '入库量16-17',
        out_time_stage16 int comment '出库量16-17',
        in_time_stage17  int comment '入库量17-18',
        out_time_stage17 int comment '出库量17-18',
        in_time_stage18  int comment '入库量18-19',
        out_time_stage18 int comment '出库量18-19',
        in_time_stage19  int comment '入库量19-20',
        out_time_stage19 int comment '出库量19-20',
        in_time_stage20  int comment '入库量20-21',
        out_time_stage20 int comment '出库量20-21',
        in_time_stage21  int comment '入库量21-22',
        out_time_stage21 int comment '出库量21-22',
        in_time_stage22  int comment '入库量22-23',
        out_time_stage22 int comment '出库量22-23',
        in_time_stage23  int comment '入库量23-24',
        out_time_stage23 int comment '出库量23-24'
)ENGINE=OLAP
DUPLICATE KEY(virt_code,agent_code,scan_site_code,store_code)
comment '三方驿站驿站各时段出入库'
PARTITION BY RANGE (date_time) ( 
   START ("2023-07-01") END ("2023-07-15") EVERY (INTERVAL 1 day))
DISTRIBUTED BY HASH(scan_site_code) BUCKETS 4
PROPERTIES (
"replication_num" = "3",
"dynamic_partition.enable" = "true",
"dynamic_partition.time_unit" = "DAY",
"dynamic_partition.time_zone" = "Asia/Shanghai",
"dynamic_partition.start" = "-90",
"dynamic_partition.end" = "3",
"dynamic_partition.prefix" = "p",
"dynamic_partition.buckets" = "4",
"in_memory" = "false",
"storage_format" = "V2"
);